Source code for src.cmd.load_rules

import os, re, sys

_region_re = re.compile('\.(xls|xlsx)')

def _get_load_regions():
    path = os.path.join(config.rule_dir, 'offense_crosswalks', 'wvfbi')
    return [_region_re.sub('', file) for file in os.listdir(path)]

[docs]def load_rules(cmd): args = cmd.args if len(args.region) == 0 and not args.wvfbi: print "Please specify one or more regions to load (example) -r mn -r az -r fl). Use -R load all regions." sys.exit(1) regions = _get_load_regions() if args.all_regions else args.region opt = {'wvfbi': args.wvfbi, 'no_replace':args.no_replace, 'verbose': args.verbose} if regions: for region in regions: _opt = opt.copy() _opt['region'] = region cmd.task_queue.put(_opt) else: opt['region'] = None cmd.task_queue.put(opt) cmd.start() cmd.task_queue.join() cmd.flush()